package com.tedu.goods.controller;

import com.tedu.goods.common.Response;
import com.tedu.goods.pojo.Goods;
import com.tedu.goods.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *
 * </p>
 *
 * @author Song
 * @since 2020/9/30
 */
@RestController
public class GoodsController {

    @Autowired
    GoodsService goodsService;

    @RequestMapping("/doFindGoods")
    public Response doFindGoods(){
        return new Response(0,"find ok",goodsService.findGoods());
    }


    @RequestMapping("/doDeleteById/{id}")
    public Response doDeleteById(@PathVariable("id") Integer id){
        goodsService.deleteById(id);
        return new Response(0,"delete ok",null);
    }

    @PostMapping("/doSaveGoods")
    public Response doSaveGoods(@RequestBody Goods goods){
        goodsService.saveGoods(goods);
        return new Response(0,"save ok",null);
    }
}
